<template>
  <div></div>
</template>
<script>
import { bus } from '@/main.js';
import { mapState, mapMutations } from 'vuex';
export default {
  name: 'player',
  mixins: [], //混入
  components: {}, //组件
  props: {}, //集成属性
  data() {
    return {
      charName: '',
      charClass: '',
      n力量: 1,
      n敏捷: 1,
      n智力: 1,
      n耐力: 1,
      n生命值: 1,
      n魔法: 1,
      头发的颜色: '',
      眼睛的颜色: '',
      皮肤的颜色: '',
    };
  },
  computed: {
    ...mapState([]),
    playerInfo: function() {
      let _ = this._;
      return {
        charName: _.get(this, 'charName', ''),
        charClass: _.get(this, 'charClass', '冒险者'),
        strength: _.get(this, 'n力量', 1),
        dexterity: _.get(this, 'n敏捷', 1),
        intelligence: _.get(this, 'n智力', 1),
        stamina: _.get(this, 'n耐力', 1),
        health: _.get(this, 'n生命值', 1),
        mana: _.get(this, 'n魔法值', 1),
        hair_color: _.get(this, '头发的颜色', ''),
        eye_color: _.get(this, '眼睛的颜色', ''),
        skin_color: _.get(this, '皮肤的颜色', ''),
      };
    },
  },
  methods: {
    ...mapMutations([]),
    test: function() {
      console.log('test');
    },

    createPlayer: function() {
      // 首次创建，这里设定保存一下，等后续一起提交
      // 后续修改，直接提交
      // this.$api
      //   .createPlayer()
      //   .then((res) => {})
      //   .catch((err) => {
      //     console.error(err);
      //   })
      //   .finally((_) => {});
    },
  },
};
</script>
<style lang="less" scoped></style>
